package com.android.example.FragmentInteraction;

import com.android.example.FragmentInteraction.AndroidListFragment.OnItemClickListener;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

public class Main extends Activity implements OnItemClickListener{
	private TextView selectedItem;
	private AndroidListFragment androidFragment;
	
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        selectedItem = (TextView) findViewById(R.id.selected_item);
        androidFragment = (AndroidListFragment)getFragmentManager().findFragmentById(R.id.android_fragment);
    }
    
    public void onItemClick(int index) {
    	selectedItem.setText(androidFragment.getItem(index));
    }
    
}